// import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'

//引入Pinia状态管理库，用于跨组件或页面共享
import { createPinia } from 'pinia'

import { createRouter,createWebHashHistory } from 'vue-router'
//引入组件
import Home from './components/HomeView.vue'
import About from './components/AboutView.vue'
import Blog from './components/Blog.vue'
import Editoradd from './components/EditorAdd.vue'

const pinia=createPinia()

// 定义路由
const routes=[
    {path:'/',component:Home},
    {path:'/home',component:Home},
    {path:'/about',component:About},
    {path:'/blog',component:Blog},
    // ?表示该路由可以传参、也可以不传参
    {path:'/editoradd/:id?',component:Editoradd}
]
// 创建路由实例
const router=createRouter({
    // 使用History模式的链接
    history:createWebHashHistory(),
    routes:routes
})
// 创建Vue根实例
const app=createApp(App)

app.use(pinia)

//使用路由到App上
app.use(router)
app.mount('#app')
